<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Log extends AdminController
{
    public $_validation = null;

    function __construct()
    {
        parent::__construct();
    }

    public function index()
    {
        $this->load->model('MShippingLog');
        $this->load->model('MAdmin');
        $allPurchaser = $this->MAdmin->getAllPurchaser();

        $this->load->library('FormFilter');
        $this->load->helper('formfilter');
        $this->formfilter->addFilter('route', 'like');
        $this->formfilter->addFilter('in_out', 'where');

        if ($begintime = filterValue('log_create_time_begin')) {
            $this->formfilter->addFilter('log_create_time_begin', 'where', array('create_time >= ', strtotime($begintime . ' 00:00:00')));
        }
        if ($endtime = filterValue('log_create_time_end')) {
            $this->formfilter->addFilter('log_create_time_end', 'where', array('create_time <= ', strtotime($endtime . ' 23:59:59')));
        }

        $number_perpage = filterValue('log_number_perpage');
        $order_type = filterValue('log_order_type');

        $total_number = $this->MShippingLog->getCount();
        $limit = $this->pagination($total_number, '', $number_perpage);
        $list = $this->MShippingLog->getList($limit, $order_type);

        $this->assign('list',$list);
        $this->assign('allPurchaser', $allPurchaser);
        $this->layout();
    }

}
